$(function() {
	sys.daterangepicker({
		id : 'orderTime',
		type : 'date',
		// startDate: moment().subtract(2, "days"), //当前时间减去一天时间
		maxDate : '2099-12-31'
	});
	$("#orderTime").val("");
	
	//订单取消类型
    sys.selectpicker({
        id : 'cancelReasonCombo', // select的id
        url : rootPath + "/dict/listKeyMapEntites", // 请求数据的远程地址
        param : {
            keyType : 'orderCancelReason'
        }, // 过滤参数
        // defaultValue:{},
        valueField : 'keyValue',
        textField : 'keyIntro'
    });
    $("#cancelReasonCombo").on("change", function() {
        $("#cancelReason").val($("#cancelReasonCombo option:selected").text());
    });
    
    
    // 订单类型
    sys.selectpicker({
        id : 'searchOrderStatus',
        url : rootPath + "/dict/listKeyMapEntites", // 请求数据的远程地址
        param : {
            keyType : 'orderStatus'
        },
        defaultAll : true,
		defaultAllText : "请选择",
        valueField : 'keyValue',
        textField : 'keyIntro'
    });
    
    // 品牌加载 
    sys.selectpicker({
		id : 'productBrandCode', // select的id
		url : rootPath + "/productBrand/getBrandList", // 请求数据的远程地址
		defaultAll : true,
		defaultAllText : "请选择",
		valueField : 'brandCode',
		textField : 'brandNameCh'
	});
    
    
    // 是否使用积分
    sys.selectpicker({
        id : 'usePointFlag',
        url : rootPath + "/dict/listKeyMapEntites",
        param : {
            keyType : 'generalStatus'
        },
        defaultAll : true,
		defaultAllText : "请选择",
        valueField : 'keyValue',
        textField : 'keyIntro'
    });
    
    
    // 是否使用优惠券
    sys.selectpicker({
        id : 'useCouponFlag',
        url : rootPath + "/dict/listKeyMapEntites",
        param : {
            keyType : 'generalStatus'
        },
        defaultAll : true,
		defaultAllText : "请选择",
        valueField : 'keyValue',
        textField : 'keyIntro'
    });
	
    
    // 选择业务员
    $.ajax({
		type:'POST',
		url: rootPath + '/dict/listKeyMapEntites',
		data : { keyType : "salesmanRoleId" },
		dataType: 'json',
		success: function(data) {  
			if (data.success == '1' && data.data.length > 0) {
				sys.selectpicker({
					id : 'salesmanCode',
					url : rootPath + '/user/getSalesmanList',
					param: {roleId: data.data[0].keyValue},
					valueField : 'id',
					textField : 'userName',
					defaultValue : $('#salesmanCode').attr('init-value'),
					defaultAll: true,
					defaultAllText: '请选择'
				})
			}
		}
	})
    
	// 客户级别
	sys.selectpicker({
		id : 'customerLevel',
		url : rootPath + "/customerLevel/listCustomerLevel",
		valueField : 'id',
		textField : 'levelName',
		defaultAll: true,
		defaultAllText: '请选择'
	});
    
	// 定义列
	var columns = [
		{
				field : 'no',
				title : '序号',
				checkbox : true ,
				width:"2%"
		},
		{
				field : 'orderCode',
				title : '订单信息',
				align : 'center',
				formatter : function(value, row, index) {
					var productDetailBuf = "";
					if(row.productList && row.productList.length > 0){
						for(var i = 0; i < row.productList.length; i ++){
							var detail = row.productList[i];
							var price_td = "";
							if(detail.productPrice != detail.productAdjustPrice){
								price_td = "	<span>调价后：¥"+numberRand2(detail.productAdjustPrice)+"</span><br/>"+
		                        "<span style='text-decoration:line-through;'>原价：¥"+detail.productPrice+"</span>";
							}else{
								price_td = "<span>原价：¥"+detail.productPrice+"</span>";
							}
							
							var spec_str = "";
							if(detail.productSpecList && detail.productSpecList.length > 0){
								spec_str = "【"
								for(var j = 0 ;j < detail.productSpecList.length; j++){
									var spec = detail.productSpecList[j];
									spec_str += spec.specName+":"+ spec.specValue + " ";
								}
							}
							if(spec_str != ""){
								spec_str += "】";
							}
							productDetailBuf+="" +
								"<tr>" +
								"	<td style='width:50px;text-align:center;'>" +
								"		<a rel='productImg' href='"+imgRootURL+detail.imagePath+"'>" +
								"			<img style='float:left;width:48px;height:48px;border:1px solid #e8e8e8;' src='"+imgRootURL+detail.imagePath+"?x-oss-process=image/resize,h_60/format,png' />" +
								"		</a>" +
								"	</td>" +
								"	<td style='width:300px;border-left:0px solid #fff;'>"+detail.productName+"<br/>"+spec_str +"</td>" +
								"	<td style='width:150px;border-left:0px solid #fff;text-align:right;'>"+
								price_td +
								"   </td>" +
								"	<td style='width:100px;border-left:0px solid #fff;'>购买数量："+detail.buyNum+"</td>" +
								"</tr>";
						}
					}
					
					var deliveryHtml = "";
					if(row.deliveryInfo) {
						deliveryHtml = "<span>物流：" + row.deliveryInfo + "</span>";
					}
					
					// <span>客户名称："+row.customerName+"</span><span>客户电话："+row.customerMobile+"</span>
					return "<div class='order_row'>" +
							"<div class='order_row_info'>" +
								"<div><span class='order_status'>"+row.orderStatusName+"</span></div>" +
								"<div class='order_field'>" + 
									"<span>订单号："+row.orderCode+"</span><span>下单时间："+row.orderTimeStr+"</span><span>客户单位："+row.customerCompanyName+"</span>" + deliveryHtml +
								"</div>" +
							"</div>" +
							"<div class='order_separator'></div>"+
							"<div>" +
							"<table class='order_detail_product_table'>" +
								productDetailBuf+
							"</table>" +
							"</div>"
			                "</div>";
				}
		},
		{	
			field : '#',
			title : '支付/发货信息',
			align : 'center',
			formatter : function(value, row, index) {
				if("04" == row.orderStatus){
					return "<div class='order_pay_info'>" +
						"<div>" +
							"<div style='display:inline-block;'><span>"+row.customerName+"</span></div>" +
							"<div><span>"+row.customerMobile+"</span></div>" +
							"<div><span>"+row.provinceName+row.cityName+row.areaName+row.streetName+row.address+"</span></div>" +
						"</div>" +
		            "</div>";
				}else{
					var payTypeNameHtm = row.payTypeName;
					// 如果已支付，显示支付方式
					if(payTypeNameHtm) {
						if(row.payType == '04' && row.bankName) {
							// 私人银行打款,把银行名称带着
							payTypeNameHtm = payTypeNameHtm + "(" + row.bankName + ")";
						}
					} else {
						// 尚未支付，显示支付模式（在线支付、货到付款）
						payTypeNameHtm = row.payModelName;
					}
					var strHtml = "<div class='order_pay_info'>" +
						"<div>" +
							"<div style='display:inline-block;'><span>应付</span><span class='order_money'>￥"+row.realPayMoney+"</span></div>" +
							"<div><span style='text-decoration:line-through;'>总计</span><span style='text-decoration:line-through;'>￥"+row.orderMoney+"</span></div>" +
						"</div>" +
						"<div class='order_separator'></div>"+
						"<div><span>" + payTypeNameHtm +"<span></div>"+
						"<div><span>使用积分：￥" + row.pointsMoney +"<span></div>"+
						"<div><span>使用优惠券：￥" + row.couponMoney +"<span></div>"+
	   					"</div>";
	   				return strHtml;
				}
				
			},
			width: "15%"
		}, {
			title : '操作',
			width: "15%",
			align : 'center',
			valign : 'middle',
			formatter : function(value, row, index) {
				
				var isSalesman = $("#isSalesman").val();
				if(isSalesman == '1'){
					if('05' == row.orderStatus){
						return "<div class='order_pay_operation'>" +
							"<div><button class='btn btn-danger btn-sm' type='button'  onclick='toSignOrder(\""+row.orderCode+"\")'>签收</button></div>" +
							"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
			            "</div>";
					}
					return "<div class='order_pay_operation'>" +
						"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
		            "</div>";
				}
				
				// 待付款状态
				if("01" == row.orderStatus || '09' == row.orderStatus){
					var resultStr = "";
					resultStr += "<div class='order_pay_operation'>";
					// 立即支付+待付款      或者 货到付款+待上传合同 
					if((row.payModel == '01' && row.orderStatus == '01') || (row.payModel == '02' && row.orderStatus == '09')){
						resultStr +=	"<div><button class='btn btn-danger btn-sm' type='button'  onclick='toAdjustOrderProductPrice(\""+row.orderCode+"\")'>调价</button></div>";
					}
					if(row.orderStatus == '01' && !(row.payModel == '02' && row.orderStatus == '01')){
						resultStr +=	"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='openCancelWin(\""+row.orderCode+"\")'>取消</button></div>";
					}
					
					resultStr += "<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>";
					resultStr += "</div>";
					return resultStr;
				} else if('02' == row.orderStatus) {
					return "<div class='order_pay_operation'>" +
								"<div><button class='btn btn-danger btn-sm' type='button'  onclick='approveOrder(\""+row.orderCode+"\",\""+row.payModel+"\")'>审核</button></div>" +
								"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
							"</div>";
				} else if('04' == row.orderStatus) {
					var resultHtml = "<div class='order_pay_operation'>";
					if(row.showSign == 'true'){
						resultHtml += "<div><button class='btn btn-danger btn-sm' style='margin-top:2px;' type='button' onclick='toSendPartOrder(\""+row.orderCode+"\")'>全部发货</button></div>";
					}else{
						resultHtml += "<div><button class='btn btn-danger btn-sm' type='button'  onclick='toSendFullOrder(\""+row.orderCode+"\")'>全部发货</button></div>";
					}
					resultHtml += "<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toSendPartOrder(\""+row.orderCode+"\")'>部分发货</button></div>";
					resultHtml += "<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>";
					resultHtml += "</div>";
					return resultHtml;
				} else if('05' == row.orderStatus) {
					return "<div class='order_pay_operation'>" +
								"<div><button class='btn btn-danger btn-sm' type='button'  onclick='toSignOrder(\""+row.orderCode+"\")'>签收</button></div>" +
								"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
							"</div>";
				} else if('08' == row.orderStatus) {
					return "<div class='order_pay_operation'>" +
								"<div><button class='btn btn-danger btn-sm' type='button'  onclick='verifyOrder(\""+row.orderCode+"\")'>核销</button></div>" +
								"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
				            "</div>";
				} 
				return "<div class='order_pay_operation'>" +
					"<div><button class='btn btn-default btn-sm' style='margin-top:2px;' type='button' onclick='toOrderDetail(\""+row.orderCode+"\")'>详情</button></div>" +
	            "</div>";
			}
		}];
			
	// 查询时间类型
	var time_type = '';
			
	// 定义查询回调函数（查询参数在此设置）
	var queryParams = function(params) {
	
		var searchKey =  $("#searchKey").val();
		var orderCode = $("#orderCode").val();
		var customerName = $("#customerName").val();
		var customerMobile = $("#customerMobile").val();
		var customerCompanyName = $("#customerCompanyName").val();
		var salesmanName = $("#salesmanName").val();
		var orderTime = $("#orderTime").val();
		var orderStatus = $("#orderStatus").val();
		
		
		var searchOrderStatus = $("#searchOrderStatus").selectpicker('val');
		var salesmanCode = $("#salesmanCode").selectpicker('val');
		var customerLevel = $("#customerLevel").selectpicker('val');
		var usePointFlag = $("#usePointFlag").selectpicker('val');
		var useCouponFlag = $("#useCouponFlag").selectpicker('val');
		var productName = $("#productName").val();
		var productCategoryId = $("#productCategoryId").val();
		var productBrandCode = $("#productBrandCode").selectpicker('val');
		
		// 如果有时间类型将时间条件取消
		if(!time_type && time_type != null){
			orderTime = "";
		}
		return {
			rows : params.limit,
			page : params.pageNumber,
			searchKey : searchKey,
			orderCode : orderCode,
			customerName : customerName,
			customerMobile : customerMobile,
			customerCompanyName : customerCompanyName,
			salesmanName : salesmanName,
			orderTime : orderTime,
			orderStatus : orderStatus,
			timeType : time_type,
			searchOrderStatus : searchOrderStatus,
			salesmanCode : salesmanCode ,
			customerLevel : customerLevel,
			usePointFlag : usePointFlag,
			useCouponFlag : useCouponFlag,
			productName : productName,
			productCategoryId : productCategoryId,
			productBrandCode : productBrandCode
		};
	};
	
	var url = rootPath + "/order/listOrderPage";
	sys.initTable('orderTable', {
		url : url,
		queryParams : queryParams,
		showColumns : false,
		columns : columns,
		striped : true,
		clickToSelect : true,
		onLoadSuccess : function(data){
			// 初始化表格复选框 
			initBootstrapTableCheckbox();
			// 初始化图片预览器
            initFancyBoxImg("productImg");
            $("#orderNum").text(data.orderNum);
            $("#orderMoney").text(formatMoney(data.orderMoney, 2));
		}
	});

	// 查询方式1
	$('#btn_query_all_order').on('click', function() {
		$("#orderCode").val("");
		$("#customerName").val("");
		$("#customerMobile").val("");
		$("#customerCompanyName").val("");
		$("#salesmanName").val("");
		$("#orderTime").val("");
		

		$("#searchOrderStatus").selectpicker('val', '');
		$("#salesmanCode").selectpicker('val', '');
		$("#customerLevel").selectpicker('val', '');
		$("#usePointFlag").selectpicker('val', '');
		$("#useCouponFlag").selectpicker('val', '');
		$("#productName").val('');
		$("#productCategoryId").val('');
		$("#productCategoryName").val('');
		$("#productBrandCode").selectpicker('val', '');
		
		sys.reloadTable('orderTable');
	});
	//查询方式2
	$("#btnQuery").on('click', function(){
		$("#searchKey").val("");
		sys.reloadTable('orderTable');
	});
	
	//状态查询
	$("#model_type").find("a").each(function(){
		$(this).on("click",function(){
			$("#model_type").find("a").attr("class","order_search_tag");
			$(this).attr("class","order_search_tag_current");
			var key = $(this).attr("name");
			$("#orderStatus").val(key);
			sys.reloadTable('orderTable');
		});
	});

	// 清空
	$('#btnClear').on('click', function() {
		$("#orderCode").val("");
		$("#customerName").val("");
		$("#customerMobile").val("");
		$("#customerCompanyName").val("");
		$("#salesmanName").val("");
		$("#orderTime").val("");
		$("#searchKey").val("");
		

		$("#searchOrderStatus").selectpicker('val', '');
		$("#salesmanCode").selectpicker('val', '');
		$("#customerLevel").selectpicker('val', '');
		$("#usePointFlag").selectpicker('val', '');
		$("#useCouponFlag").selectpicker('val', '');
		$("#productName").val('');
		$("#productCategoryId").val('');
		$("#productCategoryName").val('');
		$("#productBrandCode").selectpicker('val', '');
		
	});
	
	//切换搜索条件
	$("#btnChange1").on('click', function(){
		$("#searchKey").val("");
		$("#search_bar_1").hide();
		$("#search_bar_2").show();
		$("#btn_query_all_order").removeClass("search");
		$("#btnQuery").addClass("search");
	});
	$("#btnChange2").on('click', function(){
		$("#orderCode").val("");
		$("#customerName").val("");
		$("#customerMobile").val("");
		$("#customerCompanyName").val("");
		$("#salesmanName").val("");
		$("#orderTime").val("");
		$("#search_bar_2").hide();
		$("#search_bar_1").show();
		$("#btnQuery").removeClass("search");
		$("#btn_query_all_order").addClass("search");
	});
	
	// 最近订单查询
	$("#btn_group_search").find("button[id^='btn_']").each(function(i,item){
		$(this).click(function(){
			//清除其他搜索方式的日期搜索
			$("#orderTime").val("");
			var class_type = $(this).hasClass("btn-info");
			var timeType  = $(this).attr("id").substring(4);
			$("#btn_group_search").find("button[id^='btn_']").each(function(i,item){
				$(this).removeClass("btn-warning");
				$(this).addClass("btn-info");
			});
			if(class_type){
				$(this).removeClass("btn-info");
				$(this).addClass("btn-warning");
				time_type = timeType;
			}else{
				$(this).removeClass("btn-warning");
				$(this).addClass("btn-info");
				time_type = "";
			}
			$(this).blur();
			// $("#orderTable").bootstrapTable("refresh",{query: {timeType: timeType}});
			sys.reloadTable('orderTable');
		});
	});
	
	
	// 导出订单
	$("#btn_export_order").click(function(){
		var searchKey =  $("#searchKey").val();
		var orderCode = $("#orderCode").val();
		var customerName = $("#customerName").val();
		var customerMobile = $("#customerMobile").val();
		var customerCompanyName = $("#customerCompanyName").val();
		var salesmanName = $("#salesmanName").val();
		var orderTime = $("#orderTime").val();
		var orderStatus = $("#orderStatus").val();
		
		var btn_selected = $("#btn_group_search").find("button.btn-warning");
		var timeType = "";
		if(!btn_selected && btn_selected.attr("id") != undefined){
			timeType = $("#btn_group_search").find("button.btn-warning").attr("id").substring(4);
		}
		var form = getForm("/order/exportOrder");
		form.append("<input type='hidden'  name='searchKey'  value='"+searchKey+"'/>");
		form.append("<input type='hidden'  name='orderCode'  value='"+orderCode+"'/>");
		form.append("<input type='hidden'  name='customerName'  value='"+customerName+"'/>");
		form.append("<input type='hidden'  name='customerMobile'  value='"+customerMobile+"'/>");
		form.append("<input type='hidden'  name='customerCompanyName'  value='"+customerCompanyName+"'/>");
		form.append("<input type='hidden'  name='salesmanName'  value='"+salesmanName+"'/>");
		form.append("<input type='hidden'  name='orderTime'  value='"+orderTime+"'/>");
		form.append("<input type='hidden'  name='timeType'  value='"+timeType+"'/>");
		form.append("<input type='hidden'  name='orderStatus'  value='"+orderStatus+"'/>");
		form.submit();
	});
	
	
	// 打印订单
	$("#btn_print_order").click(function(){
		var checkedSize = $("div.checked").length;
		if(checkedSize == 0){
			layer.alert('请选择要打印的订单');
			return false;
		}
		if(checkedSize > 1){
			layer.alert('每次只能打印一条订单');
			return false;
		}
		var index = $("div.checked").closest("tr").attr("data-index");
		var row = $("#orderTable").bootstrapTable("getData")[index];
		window.location.href = rootPath + "/order/toPrintOrder?orderCode=" +row.orderCode+"&fromPage=01";
	});
	
	$("#productCategoryName").on('click', function() {
		doChoseProductCategory();
	});
	
})




/**
 * 选择商品分类
 * @Description do-something
 * @author xu_cc
 * @date 创建时间：2018年1月9日 上午11:12:56
 */
function doChoseProductCategory() {
	showRemote( rootPath + '/page/product/productCategoryTree.jsp', function() {
		//do nothing
	}, {
		title: '选择商品分类',
		width: 350,
		height: 350
	});
}


//跳转订单详情页面
function toOrderDetail(orderCode){
	window.location.href = rootPath + "/order/toOrderDetail?orderCode="+orderCode+"&tabIndex=1";
}

// 跳转编辑页面
function toEdit(id) {
	window.location.href = rootPath + "/order/toUpdateOrder?id=" + id;
}


//审核订单
function approveOrder(orderCode,payModel){
	var tabIndex = 3;
	if(payModel == '02'){
		tabIndex = 2;
	}
	window.location.href = rootPath + "/order/toOrderDetail?orderCode="+orderCode+"&tabIndex="+tabIndex;
}


//弹窗全部发货
function toSendFullOrder(orderCode){
	var url = rootPath + "/order/toSendFullOrder?orderCode="+orderCode;
	layer.open({
		  type: 2,//弹框类型
		  title: '订单发货',//弹框标题
		  area: ['750px', '470px'],//弹框大小，宽高
		  skin: 'layui-layer-lan',//皮肤
		  fixed: false, //是否固定，不固定
		  content: url,//加载内容，可以是一句话也可以是连接
		  shade:[0.8, '#393D49'],//遮罩，透明度以及颜色
		  cancel: function(index, layero){ 
			  layer.close(index)
			  return false; 
		  }
	});
}

//跳转部分发货页面
function toSendPartOrder(orderCode){
	window.location.href = rootPath + "/order/toOrderDetail?orderCode="+orderCode+"&tabIndex=4#order_send_info";
}

//全部签收
function toSignOrder(orderCode){
	
	window.location.href = rootPath + "/order/toOrderDetail?orderCode="+orderCode+"&tabIndex=4#order_send_info";
	/*
	var url = rootPath + "/order/signFullOrder";
	layer.confirm('您确定客户已收到所有商品？',{
		  btn: ['确定','取消'], //按钮
		  skin: 'layui-layer-lan' //样式类名
		}, function(index, layero){
			$.ajax({
		        type:"post",
		        url:url,
		        data:{orderCode:orderCode},
		        datatype: "json",
		        success:function(json){
		        	if(json.resultCode == '1'){
		        		$("#orderTable").bootstrapTable("refresh");
		        	}
		        	layer.close(index)
		        },
		        error: function(){
		        	showErr(json.resultMsg);
		        }
			});
		}, 
		function(index){}
	);
	*/
}



//核销订单
function verifyOrder(orderCode){
	window.location.href = rootPath + "/order/toOrderDetail?orderCode="+orderCode+"&tabIndex=3";
}

//弹窗订单调价页面
function toAdjustOrderProductPrice(orderCode){
	var url = rootPath + "/order/toAdjustOrderProductPrice?orderCode="+orderCode;
	var winIndex = layer.open({
		  type: 2,//弹框类型
		  title: '添加商品模板属性',//弹框标题
		  area: ['900px', '600px'],//弹框大小，宽高
		  skin: 'layui-layer-lan',//皮肤
		  fixed: false, //是否固定，不固定
		  content: url,//加载内容，可以是一句话也可以是连接
		  shade:[0.8, '#393D49'],//遮罩，透明度以及颜色
		  cancel: function(index, layero){ 
			  layer.close(index)
			  return false; 
		  }
	});
	//最大化
	layer.full(winIndex);
}

/**
 * 打开弹出层
 * @Description do-something
 * @author xu_cc
 * @date 创建时间：2018年2月24日 下午3:03:31
 * @param orderCode
 */
function openCancelWin(orderCode) {
	$("#cancelOrderCode").val(orderCode);
	$("#cancelIntro").val($("#cancelReasonCombo option:selected").text());
	$("#cancelModal").modal('show');
}

//取消订单
function doCancelOrder(){
	var url = rootPath + "/order/cancelOrder";
	var orderCode = $("#cancelOrderCode").val();
	var cancelReason = $("#cancelReasonCombo option:selected").text();
	var cancelIntro = $("#cancelIntro").val();
	if(orderCode) {
		var params = {
				orderCode : orderCode,
				cancelReason: cancelReason,
				cancelIntro : cancelIntro
		};
		
		$.ajax({
			type:"post",
			url:url,
			data:params,
			datatype: "json",
			success:function(json){
				$("#cancelModal").modal('hide');
				if(json.resultCode == '1') {
					layer.alert('取消成功', { icon: 6});
					$("#orderTable").bootstrapTable("refresh");
				} else {
					showMsg(json.resultMsg);
				}
			},
			error: function(){
				sys.showErr("取消失败");
			}
		});
	} else {
		sys.showErr("取消失败！");
	}
}
